<html lang="en" xml:lang="en"><head>
<META http-equiv="Content-Type" content="text/html">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><META name="description" content="WidgetManager class"><meta name="content-language" content="en"><link href="rsrc/htmlhelp.css" rel="stylesheet" type="text/css"><title>Web AppBuilder for ArcGIS | Help - WidgetManager class

</title>
                <script type="text/javascript" language="JavaScript">
                    var pathL  = self.location.pathname.split ("/");
                    var fname = pathL[pathL.length-1];
                    var i = fname.lastIndexOf (".htm");
                    if (i>=0) {
                    fname = fname.substring (0, i)
                    } else {
                    //??
                    }
                    if (self.location.hash) {
				    		      fname = fname + self.location.hash;
						        }
                    self.location.replace ("../index.html#//" + fname);
                </script>
                </head><!--Publication GUID: [GUID-E7D1C130-8F87-4109-8D61-E73A46083F52]--><!--Topic GUID: [GUID-7384E76A-9902-4A7E-95C5-5D485D774022]--><body><div id="content"><div class="header"><h1>WidgetManager class

</h1><div id="breadcrumb"></div></div>
<p id="GUID-5E6D3C80-A669-4E4E-91F7-D2FEB12E0419">This class is used to manage a widget, such as loading a widget, creating a widget,  and destroying a widget.
</p><p id="GUID-9C4447F9-0AF3-47C6-9636-C831A797DBD2">Example:</p><div class="codeblock" purpose="codeblock"><div class="highlight"><pre><code><span class="nx">require</span><span class="p">([</span><span class="s2">&quot;jimu/WidgetManager&quot;</span><span class="p">],</span> <span class="kd">function</span><span class="p">(</span><span class="nx">WidgetManager</span><span class="p">)</span> <span class="p">{</span> 
  <span class="kd">var</span> <span class="nx">wm</span> <span class="o">=</span> <span class="nx">WidgetManager</span><span class="p">.</span><span class="nx">getInstance</span><span class="p">();</span>
<span class="p">});</span>
</code></pre></div>
</div><p id="GUID-FDED04BD-E1AA-45E7-953D-0FBBE3CB6E0D">Method details:</p>

<p id="GUID-392B0A12-A1A1-4A23-A0CC-AABDC2BBB02E"><div class="block_table" id="TABLE_FB3E3B7A87094BBB9C30997D7B6225B4" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-61D72F41-1FAC-4174-96A8-C054E0BDCE8F"><b><span class="usertext">getInstance()</span></b></p><p id="GUID-E6B42A3F-BC35-4C1D-8B7E-94B7146A53F6">A static method that returns the singleton instance of the <span class="usertext">WidgetManager</span>  object.</p><p id="GUID-16AF3360-A080-4F3F-AAAA-11C7C4EF8B19"><b>Return type:</b> <span class="usertext">WidgetManager</span></p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_6B3921D45864448C9E21E0EA05CEDD08" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-333F6F6D-3A23-431D-9A4A-385119EF3915"><b><span class="usertext">loadWidget(widgetJson)</span></b></p><p id="GUID-1ABC9E3A-FFAD-4304-9614-AFE614697D62">Loads and creates a widget. If the widget, identified by widget ID, exists, the existing widget returns.</p><p id="GUID-B832D4E7-82E4-4820-BDD1-2890D811521F"><b>Parameters:</b></p><p id="GUID-ED00E304-F828-4156-A452-8EC7E412660D">widgetJson: The widget JSON object configured in the app’s config.json file.</p><p id="GUID-255EF1CD-8370-459E-894F-0847A90925CB"><b>Return type:</b> Deferred object. When the load has succeeded, the widget instance object is resolved.</p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_77BED547D357418FB7A23FBAF181CDF5" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-B7F27F00-30BE-4C8F-B559-BD4B1AFE4778"><b><span class="usertext">getWidgetById(widgetId)</span></b></p><p id="GUID-483440B6-BD1D-4466-80A3-F34915055632">Returns the widget identified by the widget ID. If the widget is not loaded, it returns <span class="usertext">undefined</span>.</p><p id="GUID-FC4BEE13-F03D-44E5-8073-6C52C378D6A2"><b>Parameters:</b></p><p id="GUID-77169A82-FBD9-4431-BCFE-39636F208E56">widgetId: The widget ID</p><p id="GUID-01F06DC9-9B03-4C86-943F-39A362545981"><b>Return type:</b> Widget instance object.</p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_4EACD1429078462E9B6F7DFA347A6ACA" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-38D534F7-6289-4B69-BB61-8EA9B082B859"><b><span class="usertext">getWidgetsByName(widgetName)</span></b></p><p id="GUID-8DCABC16-A647-4BA7-B37E-E4D07AD53E29">Returns the widgets identified by widget name. If no widget is found, it returns an empty array.</p><p id="GUID-1F9F2243-1652-4AA8-BC82-BF79766B8294"><b>Parameters:</b></p><p id="GUID-7165DC03-5A65-460E-BCB6-EE09827B46CF">widgetName: The widget name.</p><p id="GUID-BB55730A-0C31-47EB-BC28-65FE46157A93"><b>Return type:</b> Widget object array.</p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_FEA4B2F7DBB84178929623E6A564E776" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-9F39FCE1-AC48-4D00-89FC-E46ECF8F334B"><b><span class="usertext">getWidgetMarginBox(widget)</span></b></p><p id="GUID-40DE7496-A0BC-4EC8-9B6C-B5CAEE0C9EEA">Return the widget's margin box. It is useful when you want to put an off-panel widget at correct position. What the method does is to call the setPosition method,  open a widget, get the domNode margin box of the widget, and close the widget.</p><p id="GUID-72BD07E3-4EA5-4BD5-A140-92A9B59EB75D"><b>Parameters:</b></p><p id="GUID-937846AB-A48A-4C53-AE72-4D36CAD1E18C"> widget ID or widget instance</p><p id="GUID-77BFC5E4-9E11-4237-AD9C-208754D2E493"><b>Return type:</b>  Widget margin box object, which contains 4 properties:</p><ul purpose="ul" id="UL_DC46964025A4442E8F94D348519D339A"><li purpose="li" id="LI_9507DF83E39747F9B13709BB0681CFA5"> l: left</li><li purpose="li" id="LI_D49474F5DD374BA99758BC1E8E7FFBBD"> t: top</li><li purpose="li" id="LI_663DDA7E43F04188BB2316C08525D1B5"> w: width</li><li purpose="li" id="LI_6C4D62F5E83E498BBBE8DA9600006810"> h: height</li></ul></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_C8F46AD822724D3DA9629E0444A1C1F6" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-A6369AB6-393E-4293-8781-EA31C7CACC61"><b><span class="usertext">getWidgetByLabel(widgetLabel)</span></b></p><p id="GUID-861E16D1-0FF6-4237-B5D8-F52212944BA4"> Returns the widget identified by the widget label. If the widget is not loaded, the value of undefined is returned .</p><p id="GUID-4DDA8458-7A13-4312-B531-B6F0A2FE46A9"><b>Parameters:</b></p><p id="GUID-70E3ADDB-2FED-4610-AEB7-2A367041F37A"> widgetLabel: The widget label</p><p id="GUID-0BCE55F3-B096-4A59-9B5E-EE13052CD567"><b>Return type:</b> widget instance</p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_DA36106A965D489CB05A25A75A54E0AD" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-412BB112-CD29-4ED8-9C86-AFEB1FB0F586"><b><span class="usertext">getAllWidgets</span></b></p><p id="GUID-4207192F-E55B-4B7C-92CF-E1DB1B4E28A5">Returns all of the loaded widget objects.</p><p id="GUID-87069753-F094-46C4-B3E7-DB5C408F8801"><b>Return type:</b> Widget object array.</p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_9C7A7B0A14A542E8B311535F567FB262" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-6D9514F8-531A-444F-BF32-3B6456E01163"><b><span class="usertext">destroyAllWidgets</span></b></p><p id="GUID-D4AB8851-75EB-4F6A-880A-2A823334157B">Destroys all of the loaded widget objects.</p><p id="GUID-E3116196-A9F8-4687-97B8-A689CD427646"><b>Return type:</b> No return.</p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_CCEF873DC56E4D6C9B5911013C752188" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-4EDDF04F-BCAD-4055-852C-C0BC5982B1D4"><b><span class="usertext">openWidget(widget)</span></b></p><p id="GUID-2903940C-40DC-4C2A-B775-8177FA4672EC">Opens a loaded widget. It changes widget's state to  open and calls the  onOpen method of the widget. If the widget doesn't load, it does nothing.</p><p id="GUID-84FCBC78-161C-4249-BE12-3CFB6F19211F"><b>Parameters:</b></p><p id="GUID-C7984671-A7E4-4036-9239-84B7BC7F3F11">Widget ID or widget instance object.</p><p id="GUID-0F232DCF-67E1-4124-A3CE-C6E6979CF298"><b>Return type:</b> No return.</p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_4E8E91B20D6E49F78E689A1D14942ABD" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-20F4B301-BF1B-480F-8574-B9866B683F9E"><b><span class="usertext">maximizeWidget(widget)</span></b></p><p id="GUID-28915E03-9AE5-4E76-9F05-EF05F5DB420D">Maximizes a loaded widget. It changes the state of the widget's window to maximized and calls the onMaximize method of the widget. If the  widget doesn't load, it does nothing.</p><p id="GUID-49FD46B7-6722-441D-8449-BA74C3F39292"><b>Parameters:</b></p><p id="GUID-3BFE1D99-B9AF-4E82-B9CD-1A1B2680285C">Widget ID or widget instance object.</p><p id="GUID-0A5B2C4E-CED0-4C41-BDD1-AECB6B1CB186"><b>Return type:</b> No return.</p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_56F4602630C74E86A8E87E49A7452633" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-84BB9654-1095-4EB2-B779-7EF77425C33F"><b><span class="usertext">minimizeWidget(widget)</span></b></p><p id="GUID-E757B8E2-AF16-4769-B998-720FA32215A8">Minimizes a loaded widget.  It changes the state of the widget's window to minimized and calls the widget onMinimize method. If the widget doesn't load, it does nothing.</p><p id="GUID-EFEE6632-1BC4-47F3-8028-AD080A7DA15E"><b>Parameters:</b></p><p id="GUID-D4893BB8-699A-4550-A310-E6A4749E5B37">Widget ID or widget instance object.</p><p id="GUID-2BDEED5E-A290-428C-9358-704F8EDA730D"><b>Return type:</b> No return.</p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_28F0C1ED8F4B48D8BE06E007916E4A3A" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-053DE125-406D-4287-B5F4-9EED258873EA"><b><span class="usertext">normalizeWidget(widget)</span></b></p><p id="GUID-CC1FA7B7-B6D4-4CA2-8745-F62E1E6F7577">Normalizes a loaded widget. It changes the state of the widget's window to  normal and calls the onNormalize method of the widget. If the widget is not loaded, it does nothing.</p><p id="GUID-53A7FE74-EC24-45B2-B0C7-0B4DE9621360"><b>Parameters:</b></p><p id="GUID-8242F3C4-D3E7-410B-A4E3-67151DF57230">widgetName: The widget name.</p><p id="GUID-69AC54F3-04C3-41A3-B2EF-76E0ADD44A36"><b>Return type:</b> Widget object array.</p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_26ABB18204D6483587E268966EB10F34" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-B50D6396-C3DC-4529-B4E5-3707E92D12E5"><b><span class="usertext">closeWidget(widget)</span></b></p><p id="GUID-F023B292-C79B-4C14-B7EF-37B9E3FEB5E2">Closes a loaded widget. It changes widget state to closed and calls the onClose method of the widget. If the widget doesn't load, it does nothing.</p><p id="GUID-57B323BE-77E4-4E45-9DB3-429F9D7A95EB"><b>Parameters:</b></p><p id="GUID-6ECD0DEA-06AE-42E4-98A7-B3B9A646447E">Widget ID or widget instance object.</p><p id="GUID-88999709-0EAA-43AC-90E4-D637727B63B6"><b>Return type:</b> No return.</p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_5BE6A7D5E3B34C5080829AF266EEE845" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-772C1C03-82E7-44FB-8BD1-23702C0E94FD"><b><span class="usertext">destroyWidget(widget)</span></b></p><p id="GUID-D2D11F62-4F68-4296-85C4-A8C8A5C725AF">Destroys a loaded widget. If the widget doesn't load, it does nothing.</p><p id="GUID-995FAE88-1710-4937-8E8E-BD638526238A"><b>Parameters:</b></p><p id="GUID-A67CF328-FE06-4040-BA71-1F458D9D066C">Widget ID or widget instance object.</p><p id="GUID-F38AC035-EDFD-4529-8197-C9983F5E848A"><b>Return type:</b> No return.</p></td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_92DAF78C2C904B94A98AF803088023A0" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-8CDA45AB-8C38-4D1A-8BD8-5C5520E7583B"><b><span class="usertext">tryLoadWidgetConfig(widgetJson)</span></b></p><p id="GUID-EE7E1DA8-11C1-43F4-8494-277BE1196920">Loads widget configuration.<ul purpose="ul" id="UL_04A609035B33437483D4DDF506E51912"><li purpose="li" id="LI_50B4C41BA1964675917C18ACB76084D5">If widgetJson has no config property, it tries to load the config.json file in the widget folder.</li><li purpose="li" id="LI_175EF3088A474E52B1DD5D3B9C42DC7B">If the widgetJson.config file is a string, it tries to load the file that string points to.</li><li purpose="li" id="LI_1FC904699857406487CC4E5022C45F6F">If the widgetJson.config file is an object, the object will be resolved.</li></ul></p><p id="GUID-2C445A00-78EB-4240-91FC-D6326FA2424A">If the config version is older and the widget has VersionManager, it  tries to run the upgrader function and returns the latest version of the config object.</p><p id="GUID-8DE7FFE8-0B14-49F3-AA70-61AF0A6ADF0C"><b>Parameters:</b></p><p id="GUID-017A166D-2656-4BB1-AA9C-90D3C2FC1428">widgetJson: The widget JSON object configured in the app’s config.json file.</p><p id="GUID-A738FE23-E03E-4E12-A6E4-76CC23C68781"><b>Return type:</b> Deferred object. When the  load has succeeded, the widget configuration object is resolved.</p>
</td></tr></tbody></table><span class="table_desc"></span></div><div class="block_table" id="TABLE_E443318160CD48CFAD5E4BB0ADFA24BF" purpose="block_table"><span class="table_title"></span><table class="table"><tbody><tr><td purpose="entry" rowspan="1" colspan="1"><p id="GUID-94C363CF-2157-476C-9F95-B83E54C4FDE5"><b><span class="usertext">loadWidgetSettingPage(widgetJson)</span></b></p><p id="GUID-DED91AAB-C371-45C3-8611-E9A14C78EBF5">Loads the widget setting page class and creates the setting page object. The created object is not cached.</p><p id="GUID-F7F7AC1B-04F5-423E-8C92-7944C2DC7650"><b>Parameters:</b></p><p id="GUID-013F2BA0-BD38-4907-9A68-9BC6C3FFC630">widgetJson: The widget JSON object configured in the app’s config.json file.</p><p id="GUID-7F5CAA08-7F44-461E-A328-32ED319F78E9"><b>Return type:</b> Deferred object. When the  load has succeeded, the widget configuration object is resolved.</p></td></tr></tbody></table><span class="table_desc"></span></div></p><div class="footer"> Copyright © 1995-2016 Esri. All rights reserved. </div></div></body></html>